﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Soat.HappyNet.Silverlight.Library.Controls"
    xmlns:System="clr-namespace:System;assembly=mscorlib">
    
    <!--MoveableControl Style-->
    <Style TargetType="local:MoveableControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:MoveableControl">
                    <Grid x:Name="LayoutRoot" Background="{TemplateBinding Background}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.RenderTransform>
                            <TranslateTransform x:Name="LayoutRootTranslateTransform" X="0" Y="0"/>
                        </Grid.RenderTransform>
                        <ContentPresenter Grid.Row="0" x:Name="HeaderContent" Cursor="{TemplateBinding Cursor}" Content="{TemplateBinding HeaderContent}" VerticalAlignment="Top" />
                        <ContentPresenter Grid.Row="1" x:Name="ElementContent" HorizontalAlignment="Stretch" Margin="{TemplateBinding Padding}" VerticalAlignment="Stretch" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                        <ContentPresenter Grid.Row="2" x:Name="FooterContent" Content="{TemplateBinding FooterContent}" VerticalAlignment="Bottom" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--ComponentStyle MoveableControl Style-->
    <!--<Style TargetType="local:MoveableControl">
        <Setter Property="BorderBrush" Value="#FF485159"/>
        <Setter Property="BorderThickness" Value="3"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:MoveableControl">
                    <Border x:Name="LayoutRoot" BorderBrush="{TemplateBinding BorderBrush}" Margin="0" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4">
                        <Border.RenderTransform>
                            <TranslateTransform x:Name="LayoutRootTranslateTransform" X="0" Y="0"/>
                        </Border.RenderTransform>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <ContentPresenter Grid.Row="0" x:Name="HeaderContent" Cursor="{TemplateBinding Cursor}" Content="{TemplateBinding HeaderContent}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
                            <ContentControl Grid.Row="1" x:Name="ElementContent" Content="{TemplateBinding Content}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                                <ContentControl.Template>
                                    <ControlTemplate TargetType="ContentControl">
                                        <ContentPresenter HorizontalAlignment="Stretch" Margin="{TemplateBinding Padding}" VerticalAlignment="Stretch" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                                    </ControlTemplate>
                                </ContentControl.Template>
                            </ContentControl>
                            <ContentPresenter Grid.Row="2" x:Name="FooterContent" Content="{TemplateBinding FooterContent}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>-->
    
    <!--ToolboxControl Style normale a gauche-->
    <Style TargetType="local:ToolboxControl">
        <Setter Property="Background" Value="#FF0070B6"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ToolboxControl">
                    <Grid x:Name="LayoutRoot" HorizontalAlignment="Left">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonGroup">
                                <VisualState x:Name="Normal">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Arrows" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
                                            <EasingDoubleKeyFrame KeyTime="00:00:00" Value="180"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="NormalButton" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
                                            <EasingDoubleKeyFrame KeyTime="00:00:00" Value="30"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.4000000" Duration="00:00:00.0010000" Storyboard.TargetName="NormalContent" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.4000000" Duration="00:00:00.4000000" Storyboard.TargetName="NormalButton" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Hidden">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.4000000" Storyboard.TargetName="NormalButton" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="NormalButton" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
                                            <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.4000000" Value="30"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="NormalContent" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.4000000" Value="30"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Arrows" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="180"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.4000000" Storyboard.TargetName="NormalContent" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Auto">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="NormalContent" Storyboard.TargetProperty="(Control.IsDraggable)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>False</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="NormalContent" Storyboard.TargetProperty="(UIElement.VerticalAlignment)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <VerticalAlignment>Stretch</VerticalAlignment>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <local:MoveableControl x:Name="NormalContent" Background="{TemplateBinding Background}" Margin="0" Content="{TemplateBinding Content}" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Center">
                            <local:MoveableControl.Effect>
                                <DropShadowEffect/>
                            </local:MoveableControl.Effect>
                            <local:MoveableControl.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </local:MoveableControl.RenderTransform>
                            <local:MoveableControl.HeaderContent>
                                <Grid Height="30">
                                    <Rectangle Fill="Black" Stroke="Black" Margin="0"/>
                                    <Grid x:Name="Top" Margin="5,2,5,1">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <!--Image Width="20" Height="20" Source="{TemplateBinding ImageTitle}"/-->
                                        <TextBlock Grid.Column="0" Margin="0,0,10,0" HorizontalAlignment="Left" TextWrapping="Wrap" Foreground="White" FontSize="13.333" Text="{TemplateBinding Title}" VerticalAlignment="Center"/>
                                        <!--TextBlock Margin="0,0,10,0" Grid.Column="0" HorizontalAlignment="Left" Content="{TemplateBinding Title}" VerticalAlignment="Center"/-->
                                        <StackPanel Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Center" Margin="5,0,0,0">
                                            <Grid x:Name="AutoButton" Width="19" Background="Transparent" VerticalAlignment="Center" Margin="0,4,0,0" Cursor="Hand">
                                                <Rectangle Stroke="White" Height="12" Margin="3,4,4,7" Width="12"/>
                                                <Rectangle Fill="Black" Margin="9,0,0,16"/>
                                                <Path Stretch="Fill" Stroke="White" Height="10" Margin="5.562,3.271,3.438,9.729" Width="10" UseLayoutRounding="False" Data="M12.625,6.25 L2.625,16.25"/>
                                                <Path Stretch="Fill" Stroke="White" Height="5" HorizontalAlignment="Right" Margin="0,2.876,3.001,0" VerticalAlignment="Top" Width="4.75" UseLayoutRounding="False" Data="M13.125,8.375 L13.125,4 L9.375,4"/>
                                            </Grid>
                                            <Grid x:Name="HideButton" Background="Transparent"  Margin="5,0" Width="7" VerticalAlignment="Center" Height="15" Cursor="Hand">
                                                <Path Stretch="Fill" Stroke="White" HorizontalAlignment="Right" Margin="0" Width="5" UseLayoutRounding="False" Data="M192,9.25 L188.5625,12.6875 L192,16.124001" Height="11" VerticalAlignment="Center"/>
                                                <Path Stretch="Fill" Stroke="White" HorizontalAlignment="Left" Margin="-2,0,0,0" Width="3.438" UseLayoutRounding="False" Data="M192,9.25 L188.5625,12.6875 L192,16.124001" Height="7" VerticalAlignment="Center"/>
                                            </Grid>
                                        </StackPanel>
                                    </Grid>
                                </Grid>
                            </local:MoveableControl.HeaderContent>
                        </local:MoveableControl>
                        <Grid x:Name="NormalButton" Visibility="Visible" HorizontalAlignment="Left" Margin="-35,0,0,-4" Width="30" Cursor="Hand" RenderTransformOrigin="0.5,0.5">
                            <Grid.Projection>
                                <PlaneProjection/>
                            </Grid.Projection>
                            <Grid.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </Grid.RenderTransform>
                            <Rectangle Fill="Black"/>
                            <Grid x:Name="Arrows" Margin="-1,0,0,0" Width="10" VerticalAlignment="Center" Height="28" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5">
                                <Grid.Projection>
                                    <PlaneProjection RotationZ="-180"/>
                                </Grid.Projection>
                                <Grid.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform/>
                                        <SkewTransform/>
                                        <RotateTransform/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </Grid.RenderTransform>
                                <Path Stretch="Fill" Stroke="White" HorizontalAlignment="Right" Margin="0,1,-1.2,0" Width="7" UseLayoutRounding="False" Data="M192,9.25 L188.5625,12.6875 L192,16.124001" Height="19" StrokeThickness="2"/>
                                <Path Stretch="Fill" Stroke="White" HorizontalAlignment="Left" Margin="-2,1.002,0,0" Width="6" UseLayoutRounding="False" Data="M192,9.25 L188.5625,12.6875 L192,16.124001" Height="13" StrokeThickness="2"/>
                            </Grid>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:WatermarkedBox">
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Background" Value="#FFFFFFFF" />
        <Setter Property="Foreground" Value="#FF000000" />
        <Setter Property="Padding" Value="4" />
        <Setter Property="FontSize" Value="12" />
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFA3AEB9" Offset="0"/>
                    <GradientStop Color="#FF8399A9" Offset="0.375"/>
                    <GradientStop Color="#FF718597" Offset="0.375"/>
                    <GradientStop Color="#FF617584" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:WatermarkedBox">
                    <Grid x:Name="Root">
                        <Grid.Resources>
                            <SolidColorBrush x:Key="Background" Color="#FF003255"/>
                            <SolidColorBrush x:Key="BorderBrush" Color="#FF000000"/>
                            <SolidColorBrush x:Key="AccentBrush" Color="#FFFFFFFF"/>
                            <SolidColorBrush x:Key="DisabledBrush" Color="#A5FFFFFF"/>
                            <SolidColorBrush x:Key="WatermarkBrush" Color="#FFAAAAAA"/>
                            <LinearGradientBrush x:Key="FocusedStrokeBrush" StartPoint="0.5,0" EndPoint="0.5,1">
                                <GradientStop Color="#B2FFFFFF" Offset="0"/>
                                <GradientStop Color="#51FFFFFF" Offset="1"/>
                                <GradientStop Color="#66FFFFFF" Offset="0.325"/>
                                <GradientStop Color="#1EFFFFFF" Offset="0.325"/>
                            </LinearGradientBrush>
                        </Grid.Resources>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="WatermarkStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Unwatermarked" />
                                <VisualState x:Name="Watermarked">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Watermark" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                    <VisualTransition To="Focused" GeneratedDuration="0:0:0.1" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Unfocused" />
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Watermark" Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid x:Name="ContentElement">
                            <TextBox 
                                x:Name="TextBoxElement" 
                                Background="{TemplateBinding Background}"
                                Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, Mode=TwoWay}"
                                Style="{TemplateBinding TextBoxStyle}"/>
                            <PasswordBox 
                                Visibility="Collapsed"
                                Background="{TemplateBinding Background}"
                                x:Name="PasswordBoxElement"
                                local:PasswordHelper.Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Password, Mode=TwoWay}"
                                Style="{TemplateBinding PasswordBoxStyle}"/>
                        </Grid>
                        <ContentControl
                              x:Name="Watermark"
                              Opacity="0"
                              IsTabStop="False"
                              IsHitTestVisible="False"
                              VerticalAlignment="Center"
                              Content="{TemplateBinding Watermark}"
                              Foreground="{StaticResource WatermarkBrush}"
                              Background="{TemplateBinding Background}"
                              FontFamily="{TemplateBinding FontFamily}"
                              FontSize="{TemplateBinding FontSize}"
                              FontStretch="{TemplateBinding FontStretch}"
                              FontStyle="{TemplateBinding FontStyle}"
                              FontWeight="{TemplateBinding FontWeight}"
                              Padding="{TemplateBinding Padding}"
                              />

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="local:BusyPointer">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:BusyPointer">
                    <Grid x:Name="LayoutRoot" Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Busied">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="VisualElement" Storyboard.TargetProperty="(UIElement.RenderTransform).Angle" RepeatBehavior="Forever">
                                            <SplineDoubleKeyFrame KeyTime="0:0:1" Value="360" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Ellipse Width="25" Height="25" StrokeThickness="5.5" x:Name="VisualElement">
                            <Ellipse.Stroke>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FF096475" Offset="0.571"/>
                                    <GradientStop Color="#FFA8FCFC" Offset="1"/>
                                </LinearGradientBrush>
                            </Ellipse.Stroke>
                            <Ellipse.RenderTransform>
                                <RotateTransform CenterX="12.5" CenterY="12.5" />
                            </Ellipse.RenderTransform>
                        </Ellipse>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="local:ImageLoader">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ImageLoader">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="00:00:00" />
                                    <VisualTransition GeneratedDuration="00:00:00.3000000" To="Normal"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Loading">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ImageControl" Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.0000000" Duration="00:00:00.000000" 
                                                                       Storyboard.TargetName="LoadingControl" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Failed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.4000000" Duration="00:00:00.0010000" 
                                                                       Storyboard.TargetName="FailedBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Image x:Name="ImageControl" 
                               Stretch="Fill" />
                        <local:BusyPointer x:Name="LoadingControl"
                                           IsBusy="True"
                                           Visibility="Collapsed"/>
                        <Border BorderThickness="3"
                                BorderBrush="#FFFF3333"
                                x:Name="FailedBorder"
                                Visibility="Collapsed"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="local:AnimatedExpander">
        <Setter Property="Foreground" Value="#FF000000"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="BorderThickness" Value="0,0,0,1" />
        <Setter Property="BorderBrush" Value="#20ffffff" />
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,40" MappingMode="Absolute">
                    <GradientStop Color="#33ffffff" Offset="0" />
                    <GradientStop Color="#00ffffff" Offset="1" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:AnimatedExpander">
                    <Border BorderThickness="{TemplateBinding BorderThickness}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            Padding="{TemplateBinding Padding}"
                            Background="{TemplateBinding Background}"
                            x:Name="LayoutRoot"
                            >
                        <Border.Resources>
                            <Storyboard x:Key="ExpandStoryboard">
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ScrollViewer" Storyboard.TargetProperty="(FrameworkElement.Height)">
                                    <SplineDoubleKeyFrame x:Name="ExpandKeyFrame" Value="100" KeyTime="00:00:00.5"
                                                          KeySpline="0.73199999332428,0.138999998569489,0.101999998092651,0.999000012874603" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="CollapseStoryboard">
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ScrollViewer" Storyboard.TargetProperty="(FrameworkElement.Height)">
                                    <SplineDoubleKeyFrame x:Name="CollapseKeyFrame" Value="0" KeyTime="00:00:00.5"
                                                          KeySpline="0.73199999332428,0.138999998569489,0.101999998092651,0.999000012874603" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </Border.Resources>
                        <StackPanel>

                            <ToggleButton x:Name="ExpandToggleButton"
                                          IsChecked="{TemplateBinding IsExpanded}"
                                      Foreground="{TemplateBinding Foreground}"
                                      Padding="5"
                                      HorizontalContentAlignment="Stretch">
                                <ToggleButton.Template>
                                    <ControlTemplate TargetType="ToggleButton">
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="25"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>
                                            <VisualStateManager.VisualStateGroups>
                                                <VisualStateGroup x:Name="CommonStates">
                                                    <VisualState x:Name="Normal">
                                                        <Storyboard>
                                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="FlashRectangle" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.2"/>
                                                                <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
                                                            </DoubleAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="MouseOver">
                                                        <Storyboard>
                                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="FlashRectangle" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.5"/>
                                                                <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0.15"/>
                                                            </DoubleAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Pressed">
                                                        <Storyboard>
                                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FlashRectangle" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.1"/>
                                                            </DoubleAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Disabled"/>
                                                </VisualStateGroup>
                                                <VisualStateGroup x:Name="CheckStates">
                                                    <VisualState x:Name="Indeterminate"/>
                                                    <VisualState x:Name="Checked">
                                                        <Storyboard>
                                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ExpandPath" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
                                                                <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="90"/>
                                                            </DoubleAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Unchecked">
                                                        <Storyboard>
                                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ExpandPath" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
                                                                <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
                                                            </DoubleAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                </VisualStateGroup>
                                                <VisualStateGroup x:Name="FocusStates">
                                                    <VisualState x:Name="Unfocused"/>
                                                    <VisualState x:Name="Focused"/>
                                                </VisualStateGroup>
                                            </VisualStateManager.VisualStateGroups>
                                            <Rectangle Margin="1.334,0,-1.334,0" Grid.ColumnSpan="2" Fill="#FFFFFFFF" Stroke="{x:Null}" x:Name="FlashRectangle" Opacity="0"/>
                                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Column="1" Margin="{TemplateBinding Padding}"/>
                                            <Path Height="8" Width="7" HorizontalAlignment="Center" x:Name="ExpandPath" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" Fill="{TemplateBinding Foreground}" Stretch="Fill" Stroke="{TemplateBinding Foreground}" Data="M5.75,10.125 L5.75,25.25 L16.8125,17.813541 z">
                                                <Path.RenderTransform>
                                                    <TransformGroup>
                                                        <ScaleTransform/>
                                                        <SkewTransform/>
                                                        <RotateTransform/>
                                                        <TranslateTransform/>
                                                    </TransformGroup>
                                                </Path.RenderTransform>
                                            </Path>
                                        </Grid>
                                    </ControlTemplate>
                                </ToggleButton.Template>
                                <ContentPresenter
                                Content="{TemplateBinding Header}"
                                ContentTemplate="{TemplateBinding HeaderTemplate}"
                                Cursor="{TemplateBinding Cursor}"
                                Margin="{TemplateBinding Padding}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                />
                            </ToggleButton>
                            <ScrollViewer x:Name="ScrollViewer"
                                      Height="0"
                                      HorizontalScrollBarVisibility="Disabled"
                                      VerticalScrollBarVisibility="Hidden"
                                      BorderThickness="0"
                                      Padding="0"
                                      >
                                <ContentPresenter
                                x:Name="ContentContentPresenter"
                                Content="{TemplateBinding Content}"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                Cursor="{TemplateBinding Cursor}"
                                Margin="{TemplateBinding Padding}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </ScrollViewer>
                        </StackPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="local:KonamiCodeControl">
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="KeyStrokes" Value="Up, Up, Down, Down, Left, Right, Left, Right, B, A" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:KonamiCodeControl">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CodeEntry">
                                <VisualState x:Name="Inactive"/>
                                <VisualState x:Name="Active">
                                	<Storyboard>
                                		<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Container" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)">
                                			<EasingDoubleKeyFrame KeyTime="00:00:02" Value="360">
                                				<EasingDoubleKeyFrame.EasingFunction>
                                					<ElasticEase EasingMode="EaseOut" Oscillations="2" Springiness="3"/>
                                				</EasingDoubleKeyFrame.EasingFunction>
                                			</EasingDoubleKeyFrame>
                                			<EasingDoubleKeyFrame KeyTime="00:00:02.0000001" Value="0"/>
                                		</DoubleAnimationUsingKeyFrames>
                                	</Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter x:Name="Container"
                            Cursor="{TemplateBinding Cursor}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"
                                          RenderTransformOrigin="0.5,0.5">
                        	<ContentPresenter.Projection>
                        		<PlaneProjection/>
                        	</ContentPresenter.Projection>
                            <ContentPresenter.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform Angle="0"/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </ContentPresenter.RenderTransform>
                        </ContentPresenter>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:EllipsisTextBlock">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:EllipsisTextBlock">
                    <Grid x:Name="RootElement">
                        <ContentPresenter Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}" />
                        <Popup x:Name="ToolTipPopup" IsOpen="False">
                            <ContentControl>
                                <ContentControl.Template>
                                    <ControlTemplate>
                                        <Canvas>
                                            <Border x:Name="TooltipBorder" Background="Transparent" BorderBrush="Transparent" BorderThickness="0"  >
                                                <Border x:Name="ToolTipShadow" Background="#29000000" BorderThickness="0" BorderBrush="#aaaaaa"
                                                        CornerRadius="2" Canvas.ZIndex="1" Margin="2,2,0,0" Padding="0,0,2,2">
                                                    <Border x:Name="ToolTip"
                                                            BorderThickness="1" BorderBrush="#aaaaaa" CornerRadius="2" Canvas.ZIndex="2" Margin="-2,-2,0,0" Padding="3 2">
                                                        <Border.Background>
                                                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                                                <GradientStop Color="#FFFFFF" Offset=".3854"/>
                                                                <GradientStop Color="#000000" Offset=".3855"/>
                                                                <GradientStop Color="#000000" Offset=".3875"/>
                                                                <GradientStop Color="#F6F6F6" Offset=".38786"/>
                                                            </LinearGradientBrush>
                                                        </Border.Background>
                                                        <TextBlock Text="{TemplateBinding Content}" HorizontalAlignment="Left" TextWrapping="Wrap" />
                                                    </Border>
                                                </Border>
                                            </Border>
                                        </Canvas>
                                    </ControlTemplate>
                                </ContentControl.Template>
                            </ContentControl>
                        </Popup>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
    </Style>
</ResourceDictionary>
